<#function moneyToUpper n>
    <#local fraction = ['角', '分']>
    <#local digit = [ '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']>
    <#local unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']]>
    <#if n<0>
        <#local head = '欠'>
    <#else>
        <#local head =''>
    </#if>
    <#local n = n?number?abs>
    <#local s = ''>
    <#list fraction as f>
        <#local pow = 1 >
        <#list 0..(f_index-1) as i>
            pow*=10;
        </#list>
        <#list digit as d>
            <#if ((n * 10 *pow)?floor)%10 == d_index>
                <#local s = (d + f)?replace('/零./', '') + s>
            </#if>
        </#list>
    </#list>
    <#if s == ''>
        <#local s = '整'>
    </#if>
    <#local n = n?number?floor>
    <#list unit[0] as u0>
        <#if (n>0) >
            <#local p=''>
            <#list unit[1] as u1>
                <#if (n>0) >
                    <#list digit as d>
                        <#if (n % 10)==d_index>
                            <#local p = d + u1 + p>
                        </#if>
                    </#list>
                    <#local n = (n / 10)?floor>
                </#if>
            </#list>
            <#local s = (p?replace('/(零.)*零$/', '')?replace('/^$/', '零')) + u0 + s>
        </#if>
    </#list>
    <#local money = head + (s?replace('/(零.)*零元/', '元')?replace('/(零.)+/g', '零')?replace('/^整$/', '零元整'))>
    <#return money/>
</#function>